package com.bltec.emergency.service.mgrService.impl;

import com.bltec.emergency.mapper.PermissionMapper;
import com.bltec.emergency.model.Permission;
import com.bltec.emergency.service.mgrService.PermissionService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class PermissionServiceImpl implements PermissionService {
    @Resource
    PermissionMapper permissionMapper;
    @Override
    public boolean add(Permission permission) {
        return permissionMapper.insert(permission);
    }

    @Override
    public List<Permission> getAll() {
        return permissionMapper.getAll();
    }

    @Override
    public List<Permission> getPermissionIdParentIdName() {
        return permissionMapper.getPermissionIdParentIdName();
    }

    @Override
    public List<Permission> getAllPermissionByRoleId(Long roleId) {
        return permissionMapper.getAllPermissionByRoleId(roleId);
    }

    @Override
    public Permission getPermissionById(Long id) {
        return permissionMapper.getPermissionById(id);
    }

    @Override
    public boolean deletePermissionById(Long id) {
        return permissionMapper.setDisableById(id);
    }

    @Override
    public boolean updatePermissionById(Permission permission) {
        return permissionMapper.updatePermissionById(permission);
    }
}
